home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1773 < prev    next >
Encoding:
Text File  |  1996-08-06  |  699 b   |  31 lines

  1. Path: cnn.exu.ericsson.se!news
  2. From: ebumow@ebu.ericsson.com (Mickey Williams 66753)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: class defined after use?
  5. Date: 12 Jan 1996 21:02:26 GMT
  6. Organization: Ericsson Inc.
  7. Distribution: world
  8. Message-ID: <4d6i92$sgk@cnn.exu.ericsson.se>
  9. References: <4d4l4a$ecg@news1.wolfe.net>
  10. Reply-To: ebumow@ebu.ericsson.com
  11. NNTP-Posting-Host: franklin.ebu.ericsson.se
  12.  
  13. In article ecg@news1.wolfe.net,  mgooding@wolfe.net (Joshua Gooding) writes:
  14. >Is it possible to have a class with a pointer to a variable of another 
  15. >type that is defined later int he file?
  16.  
  17. Sure, just make a forward declaration:
  18.  
  19. class X;
  20. class Y{
  21. X* x;
  22. };
  23. class X{};
  24. int main()
  25. {
  26.   Y y;
  27.   return 0;
  28. }
  29.  
  30.  
  31.